﻿<UserControl x:Class="Domino.TileHorizontal"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:domino="clr-namespace:Domino" 
             mc:Ignorable="d" Height="50" Width="105" RenderTransformOrigin="0.5,0.5">
    <UserControl.Resources>
        <domino:VisibilityConverter x:Key="VisibilityConverter" />
        <domino:HideBoneyardConverter x:Key="HideBoneyardConverter" />
    </UserControl.Resources>

    <Border Name="brdMain" BorderBrush="Black" BorderThickness="2" CornerRadius="5" OpacityMask="Black">
        <Border.Background>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="#FFE78484" Offset="0"/>
                <GradientStop Color="#FFF50000" Offset="1"/>
            </LinearGradientBrush>
        </Border.Background>

        <Grid Visibility="{Binding TileLocation, Converter={StaticResource HideBoneyardConverter}}">
            <Grid Name="MainLayout" ToolTip="{Binding TileTooltip}" 
                  Visibility="{Binding IsNullValue, Converter={StaticResource VisibilityConverter}, ConverterParameter=-}">
                <Grid.RowDefinitions>
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition Width="5" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>

                <domino:TilePart x:Name="tpartLower" TileValue="{Binding LeftTileValue}" SnapsToDevicePixels="True" />
                <Rectangle Grid.Column="1" Margin="0,2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Fill="Black" />
                <domino:TilePart x:Name="tpartUpper" Grid.Column="2" TileValue="{Binding RightTileValue}" Panel.ZIndex="15" />
            </Grid>

            <Grid Visibility="{Binding IsNullValue, Converter={StaticResource VisibilityConverter}}">
                <Label HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontWeight="Bold" FontSize="20" Content="xxx    xxx" />
            </Grid>
        </Grid>
    </Border>
</UserControl>
